// 客户资料
<template>
  <div class="app-container">
    <el-container>
      <el-main>
        <div ref="borrow">
          <el-row class="bgc">
            <el-col :span="24"> 企业概况</el-col>
          </el-row>
          <el-row class="bgc pd-20">
            <el-col :span="24"> 开户要素</el-col>
          </el-row>
          <el-form :label-position="labelPosition" label-width="160px" :model="loanInfo" :inline="true">
            <el-form-item label="企业名称">
              <el-input v-model="loanInfo.compName" disabled />
            </el-form-item>
            <el-form-item label="企业类型">
              <el-input v-model="loanInfo.compType" disabled />
            </el-form-item>
            <el-form-item label="国籍">
              <el-input v-model="loanInfo.nation" disabled> </el-input>
            </el-form-item>
            <el-form-item label="证件类型">
              <el-input v-model="loanInfo.certType" disabled> </el-input>
            </el-form-item>
            <el-form-item label="证件号码">
              <el-input v-model="loanInfo.certNumber" disabled />
            </el-form-item>
            <el-form-item label="证件到期日">
              <el-date-picker v-model="loanInfo.certExpire" type="date" placeholder="请选择日期" disabled />
              <!-- <el-input v-model="loanInfo.certExpire" /> -->
            </el-form-item>
            <el-form-item label="行业类型">
              <el-input v-model="loanInfo.industryType" disabled />
            </el-form-item>
            <el-form-item label="企业成立日期">
              <el-date-picker v-model="loanInfo.compOpenTime" type="date" placeholder="请选择日期" disabled />
              <!-- <el-input v-model="loanInfo.compOpenTime" /> -->
            </el-form-item>
            <el-form-item label="法人证件失效日期">
              <el-date-picker v-model="loanInfo.bossCertExpire" type="date" placeholder="请选择日期" disabled />
              <!-- <el-input v-model="loanInfo.bossCertExpire" /> -->
            </el-form-item>
          </el-form>
        </div>

        <div ref="bank">
          <el-row class="bgc pd-20">
            <el-col :span="24">基础信息</el-col>
          </el-row>
          <el-form :label-position="labelPosition" label-width="160px" :model="loanInfo" :inline="true">
            <el-form-item label="客户性质">
              <el-input v-model="loanInfo.customerNature" disabled />
            </el-form-item>
            <el-row class="bgc pd-20">
              <el-col :span="24">联系地址信息</el-col>
            </el-row>
            <el-form-item label="地址类型">
              <el-input v-model="loanInfo.addressType" disabled />
            </el-form-item>
            <el-form-item label="是否通讯地址">
              <el-switch v-model="loanInfo.isMailAddress" class="mb-2" active-text="是" inactive-text="否" active-value="true" inactive-value="false" disabled />
            </el-form-item>
            <el-form-item label="地址所属国家/区域">
              <el-input v-model="loanInfo.homeCountry" disabled />
            </el-form-item>
            <el-form-item label="地址所属区/县">
              <el-input v-model="loanInfo.homeRegion" disabled />
            </el-form-item>
            <el-form-item label="地址详情">
              <el-input v-model="loanInfo.homeDetail" disabled />
            </el-form-item>
            <el-row class="bgc pd-20">
              <el-col :span="24">联系电话信息</el-col>
            </el-row>
            <el-form-item label="电话类型">
              <el-input v-model="loanInfo.phoneType" disabled />
            </el-form-item>
            <el-form-item label="国际区号">
              <el-input v-model="loanInfo.interAreaCode" disabled />
            </el-form-item>
            <el-form-item label="电话号码">
              <el-input v-model="loanInfo.phoneNumber" disabled />
            </el-form-item>
            <el-form-item label="是否为短信接收号码">
              <el-switch v-model="loanInfo.isShortMsg" class="mb-2" active-text="是" inactive-text="否" active-value="true" inactive-value="false" />
            </el-form-item>
            <el-form-item label="备注">
              <el-input v-model="loanInfo.branchName" />
            </el-form-item>
          </el-form>
        </div>

        <div ref="borrow">
          <el-row class="bgc">
            <el-col :span="24"> 企业高管信息</el-col>
          </el-row>
          <el-row class="bgc pd-20">
            <el-col :span="24"> 法人</el-col>
          </el-row>
          <el-form :label-position="labelPosition" label-width="160px" :model="loanInfo" :inline="true">
            <el-form-item label="法人姓名">
              <el-input v-model="loanInfo.bossName" disabled />
            </el-form-item>
            <el-form-item label="证件号码">
              <el-input v-model="loanInfo.bossCertNumber" disabled />
            </el-form-item>
            <el-form-item label="证件到期日">
              <el-date-picker v-model="loanInfo.bossCertExpire" type="date" placeholder="请选择日期" disabled />
              <!-- <el-input v-model="loanInfo.bossCertExpire" /> -->
            </el-form-item>
            <!-- <el-form-item label="职业状况">
              <el-input v-model="loanInfo.bossJobStatus" />
            </el-form-item> -->
            <el-form-item label="担任职务">
              <el-input v-model="loanInfo.bossJobStatus" disabled />
            </el-form-item>
          </el-form>
        </div>

        <div ref="identity">
          <el-row class="bgc">
            <el-col :span="24">影像采集：营业执照、法人身份证正反面</el-col>
          </el-row>
          <el-form :label-position="labelPosition" label-width="160px" :model="loanInfo" :inline="true">
            <el-form-item label="身份证正/反面">
              <el-image style="width: 100px; height: 100px" :src="frontUrl" :zoom-rate="1.2" :preview-src-list="frontList" :initial-index="0" fit="cover" />
            </el-form-item>
            <el-form-item label="手持身份证" style="max-width: 460px">
              <el-image style="width: 100px; height: 100px" :src="versoUrl" :zoom-rate="1.2" :preview-src-list="versoList" :initial-index="0" fit="cover" />
            </el-form-item>
          </el-form>
        </div>

        <!-- <el-row style="margin-bottom: 10px">
          <el-col :span="12" :offset="10"> <el-button type="primary" @click="onSubmit">提交</el-button></el-col>
        </el-row> -->
      </el-main>
    </el-container>
  </div>
</template>
<script setup>
import { onMounted, reactive, ref } from "vue";
import { getFirmDetail, getFirmMaintain } from "@/api/guarantee";
import { ElMessageBox, ElMessage, ElLoading } from "element-plus";
import { useRouter } from "vue-router";
import $tab from "@/plugins/tab.js";
const { proxy } = getCurrentInstance();
const router = useRouter();
const route = useRoute();
const labelPosition = ref("right");
const borrow = ref(null);
const identity = ref(null);
const bank = ref(null);
const frontUrl = ref(null); //正面
const frontList = ref([]); //正面预览
const versoUrl = ref(null); //反面
const versoList = ref([]); //反面预览

const props = defineProps({
  // dataFrom: {
  //   type: Object,
  //   required: true,
  // },
  // type: {
  //   type: String,
  // },
});

const state = reactive({
  loanInfo: {}, //担保信息

  lists: [], //展示菜单项
});

const { loanInfo } = toRefs(state);
const url = "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg";
const srcList = [
  "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg",
  "https://fuss10.elemecdn.com/1/34/19aa98b1fcb2781c4fba33d850549jpeg.jpeg",
  "https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg",
  "https://fuss10.elemecdn.com/9/bb/e27858e973f5d7d3904835f46abbdjpeg.jpeg",
  "https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg",
  "https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg",
  "https://fuss10.elemecdn.com/2/11/6535bcfb26e4c79b48ddde44f4b6fjpeg.jpeg",
];

function getList() {
  console.log(route.query.id, "22222");
  getFirmDetail(route.query.id).then((res) => {
    console.log(res, "详情");
    if (res.code == 200) {
      loanInfo.value = res.data;
      frontUrl.value = "http://116.228.78.26:52800/nymanagerFile/" + res.data.frontIdcard;
      versoUrl.value = "http://116.228.78.26:52800/nymanagerFile/" + res.data.reverseIdcard;
      versoList.value.push(versoUrl.value);
      frontList.value.push(frontUrl.value);
    }
  });
}
function onSubmit() {
  getFirmMaintain(loanInfo.value).then((res) => {
    if (res.code == 200) {
      proxy.$modal.msgSuccess(res.msg);
      getList();
    } else {
      proxy.$modal.msgWarning(res.msg);
    }
  });
}

onMounted(() => {
  getList();
});
</script>

<style>
.demo-form-inline .el-input {
  --el-input-width: 220px;
}
</style>

<style lang="scss" scoped>
// :deep(.el-container) {
//   // padding: 20px;
// }
.customer {
  width: 100%;
  box-sizing: border-box;
  overflow: auto;
  // padding: 20px;
}
.bgc {
  background: #f2f2f2;
  margin-bottom: 5px;
  height: 30px;
  line-height: 30px;
  font-size: 16px;
}
.box1 {
  text-align: center;
  color: #999;
  border-bottom: 1.5px solid #e4e4e4;
  &:hover {
    cursor: pointer;
    color: #000;
  }
}
.pd-20 {
  padding-left: 20px;
}
.mg-30 {
  margin-left: 100px;
}

:deep(.el-aside) {
  margin-top: 5px;
  background: #fff;
}
:deep(.el-main) {
  padding: 0;
  // flex: 80%;
}
.active {
  text-align: center;
  color: #000;
  border-bottom: 2px solid #000;
}
.personStyle {
  margin-right: 20px;
}
:deep(.el-form-item--default) {
  margin-bottom: 5px;
  width: 40%;
}
:deep(.el-select) {
  width: 100%;
}
:deep(.el-form-item) {
  margin-right: 120px;
}
.customer-right {
  position: fixed;
  border: 1px solid #e4e4e4;
  padding: 20px;
}

.item-mg {
  margin-top: 38px;
}
</style>
